<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [9,20,22,15];
        // 方法1
        console.log(Math.max(...arr))
        // 方法2
        var num = arr[0];
        for(var i = 1 ; i <　arr.length ; i++){
            if(num<arr[i]){
                num =arr[i];
            }
        }
        console.log(num)
    </script>
</body>
</html>